// Copyright 2011 Edward Wahlen. All Rights Reserved.

package org.wahlen.pc;

import com.google.common.collect.Lists;

import java.util.List;

/**
 * Function to emit some value.
 *
 * @author edward.wahlen@gmail (Edward Wahlen)
 */
public interface EmitFn<T> {

  void emit(T t);

  /**
   * Collects emitted values into a buffer.
   */
  public static class Collect<T> implements EmitFn<T> {

    public final List<T> buffer = Lists.newArrayList();

    public void emit(T s) {
      buffer.add(s);
    }
  }
}
